#ifndef OEWALLETMANAGEWIDGET_H
#define OEWALLETMANAGEWIDGET_H

#include <QWidget>

class QStandardItemModel;
class QTableView;
class QVBoxLayout;
class QLabel;
class QSpinBox;
class QCheckBox;

class SRCreateWallet;
class SRCreateWalletPage;

class OEWalletManage;
class OEWalletManageWidget : public QWidget
{
    Q_OBJECT
public:
    explicit OEWalletManageWidget(QWidget *parent = 0);

    static bool copyDir(const QString &_srcPath,
                        const QString &_destDir,
                        bool coverFileIfExist);
signals:


protected:

    void onUpdate(void);

    void insertTableData(int _row ,const QString& _walletName,
                         const QString& _status,
                         const QString& _author,
                         const QString& _crtTime,
                         const QString& _absPath);

    void showEvent(QShowEvent *event);

private:

    bool isWalletStatus(const QString& _status);
    bool isSelectedTable(void);
public slots:

    // 密语创建钱包
    void onCreateWalletFromCryptolalia(void);

    // 密语恢复钱包
    void onGetbackWalletFromCryptolalia(void);

    // 文件恢复钱包
    void onGetbackWalletFromFile(void);


    // 导出钱包
    void onBatchExportWallet(void);
    void onExportWallet(int _row = -1, const QString& _exportAddr = "");

    // 导出公钥
    void onBatchExportPubKey(void);
    void onExportPubKey(int _row = -1 , const QString& _exportAddr = "");

    // 隐藏钱包
    void onBatchHideWallet(void);
    void onHideWallet(int _row = -1);

private Q_SLOTS:

    void onNextPage(int _pageNumber);

    void onTableClick(const QModelIndex &_index);



private:
    QLabel* labWalletCount_;
    QStandardItemModel *model_;
    QTableView* tableView_;
    QSpinBox* boxPage_;

    QCheckBox* checkNormal_;
    QCheckBox* checkUse_;
    QCheckBox* checkBusy_;
    QCheckBox* checkHide_;
private:


    SRCreateWalletPage* createWalletPage_;
    QVBoxLayout* layout_;

    OEWalletManage* walletInfo_;

};

#endif // OEWALLETMANAGEWIDGET_H
